package com.loongtech.bi.manager.game;

import com.loongtech.bi.entity.game.EntityMallStatisticsAll;
import com.loongtech.core.jpa.manager.ManagerQueryCacheBase;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
/*
 * 全部商城统计
 */
@Service
public class MallStatisticsAllManager extends ManagerQueryCacheBase<EntityMallStatisticsAll> {
	private static final long serialVersionUID = 1L;
	
	//根据区服查询
	public List<Object[]> getMallStatisticsAllByAllKind(Date dateStart, Date dateEnd, String queryPlatform, String queryChannel, String queryServer,String currencytype) {
		return findByQuery("select date_format(day,'%Y-%m-%d'),-1,param,sumchangenum,times,rolenum,currencytype,reason from EntityMallStatisticsAll  where 1=1  and currencytype in "+ currencytype +" and day>=:dayStart and day<=:dayEnd and platformid = '"+queryPlatform+"' and serverid = '"+queryServer+"' and channelid = '"+queryChannel+"' order by day desc", "dayStart", dateStart, "dayEnd", dateEnd);
	}
	
	//根据物品id查询
	public List<Object[]> getMallStatisticsAllByAllKindByParam(Date dateStart, Date dateEnd, String queryPlatform, String queryChannel, String queryServer,String currencytype,Long param) {
		return findByQuery("select date_format(day,'%Y-%m-%d'),-1,param,sumchangenum,times,rolenum,currencytype,reason from EntityMallStatisticsAll  where 1=1 and param = "+param+" and currencytype in "+ currencytype +" and day>=:dayStart and day<=:dayEnd and platformid = '"+queryPlatform+"' and serverid = '"+queryServer+"' and channelid = '"+queryChannel+"' order by day desc", "dayStart", dateStart, "dayEnd", dateEnd);
	}

    //根据区服查询
    public List<Object[]> getMallStatisticsAllByAllKind(Date dateStart, Date dateEnd, String queryPlatform, String queryChannel, String queryServer,String currencytype, String reason) {
        return findByQuery("select date_format(day,'%Y-%m-%d'),-1,param,sumchangenum,times,rolenum,currencytype,reason from EntityMallStatisticsAll  where 1=1 and reason=" + reason + " and currencytype in "+ currencytype +" and day>=:dayStart and day<=:dayEnd and platformid = '"+queryPlatform+"' and serverid = '"+queryServer+"' and channelid = '"+queryChannel+"' order by day desc", "dayStart", dateStart, "dayEnd", dateEnd);
    }

    //根据物品id查询
    public List<Object[]> getMallStatisticsAllByAllKindByParam(Date dateStart, Date dateEnd, String queryPlatform, String queryChannel, String queryServer,String currencytype,Long param, String reason) {
        return findByQuery("select date_format(day,'%Y-%m-%d'),-1,param,sumchangenum,times,rolenum,currencytype,reason from EntityMallStatisticsAll  where 1=1 and reason=" + reason + " and param = "+param+" and currencytype in "+ currencytype +" and day>=:dayStart and day<=:dayEnd and platformid = '"+queryPlatform+"' and serverid = '"+queryServer+"' and channelid = '"+queryChannel+"' order by day desc", "dayStart", dateStart, "dayEnd", dateEnd);
    }

}
